#include<iostream>
#define yu(a,b) a%b;
using namespace std;
int main(){
	int a,b,t;
	scanf("%d%d",&a,&b);
	t=yu(a,b);
	printf("%d\n",t);
	return 0;
}
